package com.czy.owner.adapter;

import android.content.Context;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;

import com.czy.owner.R;
import com.czy.owner.entity.MyOrderDetailModel;

import java.util.List;

import static com.czy.owner.R.id.tv_jine;
import static com.czy.owner.R.id.tv_service_name;

/**
 * Created by wangyang on 2017/3/21 0021.
 */

public class MyOrderDetailCustomAdapter extends BaseRecyclerAdapter<MyOrderDetailModel.CustomItemListBean ,MyOrderDetailCustomAdapter.OrderDetailCostomHolder> {

    public MyOrderDetailCustomAdapter(Context context, List<MyOrderDetailModel.CustomItemListBean> list) {
        super(context, list);

    }

    @Override
    public void onBindViewHolder(OrderDetailCostomHolder holder, int position) {
        super.onBindViewHolder(holder, position);
        holder.bindData(data.get(position));
    }

    @Override
    public OrderDetailCostomHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        return new OrderDetailCostomHolder (layoutInflater.inflate(R.layout.item_order_detail_custom, parent, false));
    }

    public class OrderDetailCostomHolder extends BaseRecyclerAdapter.ViewHolder{
        private TextView tvServiceName;
        private TextView tvJine;
        public OrderDetailCostomHolder(View itemView) {
            super(itemView);

            tvServiceName = (TextView)itemView.findViewById(R.id.tv_service_name);
            tvJine = (TextView)itemView.findViewById(R.id.tv_jine);


        }
        public void bindData(MyOrderDetailModel.CustomItemListBean model){
            tvServiceName.setText(model.getItemName());
            tvJine.setText("￥"+ String.format("%.2f",model.getPrice()));


        }
    }
}
